<?php
/**
 * 
 * ClientEngage: ClientEngage Visitor Voice (http://www.clientengage.com)
 * Copyright 2012, ClientEngage (http://www.clientengage.com)
 *
 * You must have purchased a valid license from CodeCanyon in order to have 
 * the permission to use this file.
 * 
 * You may only use this file according to the respective licensing terms 
 * you agreed to when purchasing this item on CodeCanyon.
 * 
 * 
 * 
 *
 * @author          ClientEngage <contact@clientengage.com>
 * @copyright       Copyright 2013, ClientEngage (http://www.clientengage.com)
 * @link            http://www.clientengage.com ClientEngage
 * @since           ClientEngage - Visitor Voice v 1.0
 * 
 */
?>


<?php if (count($stats['values']) > 0): ?>
    <?php
    App::uses('Descriptives', 'Lib');
    $result = Descriptives::calc($stats['values']);
    ?>
    <table class="table table-condensed table-striped">
        <tbody>
            <tr>
                <th class="text_frequencies-header"><?php echo __('Min'); ?></th>
                <td><?php echo '<span title="', $result['min'], '">', round($result['min'], 2), '</span>'; ?></td>
            </tr>  
            <tr>
                <th><?php echo __('Max'); ?></th>
                <td><?php echo '<span title="', $result['max'], '">', round($result['max'], 2), '</span>'; ?></td>
            </tr>
            <tr>
                <th><?php echo __('Range'); ?></th>
                <td><?php echo '<span title="' . $result['range'] . '">' . round($result['range'], 2), '</span>'; ?></td>
            </tr>
            <tr>
                <th><?php echo __('Count'); ?></th>
                <td><?php echo $result['count']; ?></td>
            </tr>
            <tr>
                <th><?php echo __('Sum'); ?></th>
                <td><?php echo '<span title="' . $result['sum'] . '">' . round($result['sum'], 2), '</span>'; ?></td>
            </tr>
            <tr>
                <th><?php echo __('Mean'); ?></th>
                <td><?php echo '<span title="' . $result['mean'] . '">' . round($result['mean'], 2), '</span>'; ?></td>
            </tr>
            <tr>
                <th><?php echo __('Median'); ?></th>
                <td><?php echo '<span title="' . $result['median'] . '">' . round($result['median'], 2), '</span>'; ?></td>
            </tr>
            <tr>
                <th><?php echo __('Mode'); ?></th>
                <td><?php echo '<span title="' . $result['mode'] . '">' . round($result['mode'], 2), '</span>'; ?></td>
            </tr>
            <?php if (isset($result['var'])): ?>
                <tr>
                    <th><?php echo __('Variance of the Sample'); ?></th>
                    <td><?php echo '<span title="' . $result['var'] . '">' . round($result['var'], 2), '</span>'; ?></td>
                </tr>
            <?php endif; ?>
            <?php if (isset($result['stddev'])): ?>
                <tr>
                    <th><?php echo __('Standard Deviation of the Sample'); ?></th>
                    <td><?php echo '<span title="' . $result['stddev'] . '">' . round($result['stddev'], 2), '</span>'; ?></td>
                </tr>
            <?php endif; ?>

        </tbody>
    </table>
<?php else: ?>
    <div class="well"><?php echo __('No data available'); ?></div>
<?php endif; ?>